#include "Pthread.hpp"
#include <unordered_map>
#include <memory>

#define NUM 10

using thread_ptr_t = std::shared_ptr<ThreadModule::Thread>;

int main()
{
    //创建多线程
    std::unordered_map<std::string,thread_ptr_t> threads;
    for(int i = 0;i < NUM;i++)
    {
        thread_ptr_t t = std::make_shared<ThreadModule::Thread>([](){
            while(true)
            {
                std::cout << "hello world" << std::endl;
                sleep(1);
            }
        });
        threads[t->Name()] = t;
    }

    for(auto& thread:threads)
    {
        thread.second->Start();
    }
     for(auto& thread:threads)
    {
        thread.second->Join();
    }


    return 0;
}